package com.invengo.module_robot.ui.binding.speedview;

import androidx.databinding.BindingAdapter;

import com.invengo.library_orionstar.ActionEvent;
import com.invengo.module_robot.ui.fragment.weiget.SpeechView;

import me.goldze.mvvmhabit.binding.command.BindingCommand;

/**
 * @author buoker
 * @version 1.0.0
 * @date 2024/03/20
 * @className java.lang.String
 */
public class ViewAdapter {

    /**
     * 设置通话命令
     *
     * @param speechView    语音视图
     * @param searchCommand search命令
     * @param actionCommand 动作命令
     */
    @BindingAdapter(value = {"searchCommand","actionCommand"},requireAll = false)
    public static void setSpeakCommand(final SpeechView speechView, final BindingCommand<String> searchCommand, final BindingCommand<ActionEvent> actionCommand){
        speechView.setSearchCommand(searchCommand);
        speechView.setActionCommand(actionCommand);
    }

    /**
     * 设置答案值
     *
     * @param speechView  语音视图
     * @param answerValue 答案值
     */
    @BindingAdapter(value = {"answerValue"},requireAll = false)
    public static void setAnswerValue(final SpeechView speechView,final String answerValue){
        speechView.setAnswerValue(answerValue);
    }
}
